a = input()
b = input().split()


def paixu(x):
    for i in range(0, len(x)-1):
        if x[i] + x[i+1] < x[i+1] + x[i]:
            x[i], x[i + 1] = x[i + 1], x[i]


b.sort(reverse=True)
paixu(b)
print("".join(str(i) for i in b))